@extends('admin.layout.layout')
@section('content')

 
@component('admin.components.content.rightContent')
        @slot('rightContent')

        <div class="mt-3  mb-3  d-flex justify-content-between container-fluid">
                                            
                <div class="col-md-3 row justify-content-between">
                    <form action="?" class="d-flex">
                        <input type="hidden" value="{{$is_trashed}}" name="trashed">
                        <input type="text" class="form-control form-control-sm col-md-9" name="keyWord" placeholder="按形状名搜索" value="{{$keyWord}}">
                        <button type="submit" class="btn btn-secondary"><i class="icon-search"></i></button>
                    </form>
                </div>

                <div class="col-md-9 row justify-content-end">

                    @if($is_trashed)

                        @component('admin.components.button.button',[
                            'text'=>'恢复已选',
                            'style'=>'info',
                            'classes'=>'restore-checked mr-1',
                            'action'=>url('/admin/shape/restoreChecked'),
                        ])
                        @endcomponent

                        @component('admin.components.button.href',[
                            'href'=>url('/admin/shape'),
                            'text'=>'返回列表',
                            'style'=>'success'
                        ])
                        @endcomponent
                        
                    @else  
                        @component('admin.components.button.button',[
                            'text'=>'新增形状',
                            'mini'=>url('/admin/shape/create'),
                            'title'=>'新增形状',
                            'classes'=>'mr-1'
                        ])
                        @endcomponent

                        @component('admin.components.button.button',[
                            'text'=>'删除已选',
                            'style'=>'danger',
                            'classes'=>'delete-checked mr-1',
                            'action'=>url('/admin/shape/deleteChecked'),
                        ])
                        @endcomponent

                        @component('admin.components.button.href',[
                            'href'=>url('/admin/shape?trashed=1'),
                            'text'=>'查看回收站',
                            'style'=>'secondary'
                        ])
                        @endcomponent
                    @endif

            </div>

        </div>
        <table class="table table-striped table-hover r-0">
            <thead>
            <tr class="no-b">
                <th style="width: 30px">
                    <div class="custom-control custom-checkbox">
                        <input type="checkbox" id="checkedAll" class="custom-control-input"><label class="custom-control-label" for="checkedAll"></label>
                    </div>
                </th>
                <th>形状名称</th>
                <th>默认字段</th>
                <th>自定义字段</th>
                <th>创建时间</th>
                <th>更新时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
                @forelse($pageListData as $item)
                    <tr>
                        <td>
                            <div class="custom-control custom-checkbox">
                                <input type="checkbox" id="checkbox{{$item->id}}" class="custom-control-input  table-checkbox"><label class="custom-control-label" for="checkbox{{$item->id}}"></label>
                            </div>
                        </td>
                        <td>{{$item->shape_name}}</td>
                        <td>{{$item->default_ids}}</td>
                        <td>{{$item->custom_ids}}</td>
                        <td>{{$item->created_at}}</td>
                        <td>{{$item->updated_at}}</td>
                        <td>
                            <div class="d-flex">

                                @if($is_trashed)

                                @component('admin.components.form.formButton',[
                                    'action'=>url('/admin/shape/restoreChecked'),
                                    'right'=>'恢复',
                                    'title'=>'是否恢复?',
                                    'icon'=>'restore',
                                    'style'=>'info'
                                ])
                                    @slot('slot')
                                         <input type="hidden" name="id" value="{{$item->id}}">
                                    @endslot
                                @endcomponent

                                @component('admin.components.form.formButton',[
                                    'action'=>url('/admin/shape/forceDeleteChecked'),
                                    'right'=>'强制删除',
                                    'title'=>'是否强制删除?',
                                    'icon'=>'delete',
                                    'style'=>'danger',
                                    'dangerMode'=>true
                                ])
                                    @slot('slot')
                                        <input type="hidden" name="id" value="{{$item->id}}">
                                    @endslot
                                @endcomponent

                            @else

                                @component('admin.components.button.hrefButton',[
                                    'mini'=>url('/admin/shape',['id'=>$item->id,'method'=>'edit']),
                                    'text'=>'编辑',
                                    'title'=>'形状编辑',
                                    'titleText'=>'编辑',
                                    'icon'=>'pencil'
                                ])
                                @endcomponent

                                @component('admin.components.form.formButton',[
                                    'action'=>url('/admin/shape',$item->id),
                                    'right'=>'删除',
                                    'title'=>'是否删除?',
                                    'icon'=>'delete',
                                    'style'=>'danger',
                                    'dangerMode'=>true,
                                    'method'=>'delete'
                                ])
                                @endcomponent

                            @endif

                            
                            </div>
                        </td>
                    </tr>
                @empty
                <tr>
                    <td colspan="12" align="center">没有更多了</td>
                </tr>
                @endforelse
            </tbody>
        </table>

            {{$pageListData->appends(['trashed'=>$is_trashed,'keyWord'=>$keyWord])->links()}}
    @endslot

@endcomponent
 
  
@endsection